package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.Feedback;
import com.cskaoyan.service.FeedbackService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("wx/feedback")
public class FeedBackWxController {
    @Autowired
    FeedbackService feedbackService;
    @RequestMapping("submit")
    public BaseRespVo submit(@RequestBody Feedback feedback){
        Subject subject = SecurityUtils.getSubject();
        Integer userId = (Integer) subject.getPrincipal();
        feedback.setUserId(userId);
        feedbackService.submitFeedback(feedback);
        return BaseRespVo.ok();
    }
}
